package com.yifi.system.controller;

import java.util.List;

import com.jfinal.aop.Inject;
import com.jfinal.core.Path;
import com.yifi.common.base.BaseController;
import com.yifi.common.model.MenuModel;
import com.yifi.common.utils.StringUtils;
import com.yifi.common.utils.ToolSession;
import com.yifi.system.domain.MisUser;
import com.yifi.system.service.MenuService;

@Path(value="/maintop",viewPath = "/")
public class MainTopController extends BaseController {

	@Inject
	private MenuService menuService;
	
	public void index()
	{
		String isweb = getPara(0, "");
		if (StringUtils.isNotEmpty(isweb)) {
			redirect("/");
		} else {
			MisUser misUser = ToolSession.getUser(this);
			loginDesc("登录成功");
			if (misUser != null) {
				setAttr("user", misUser);
			}

			// 用户权限菜单
			List<MenuModel> listMenu = menuService.getMenuTop(misUser.getCcode());
			setAttr("menus", listMenu);

			setAttr("sid",getSessionAttr("sid",""));

			render("system/maintop.html");
		}
	}
	
	public void maindefault()
	{
		render("system/maindefault.html");
	}
	
	
}
